/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bean;

import java.io.Serializable;

/**
 *
 * @author fernando
 */
public class Autor implements Serializable {

    private int id = -1 ;
    private String ultimoNome = "";
    private String restanteNome = "";
    private String lattes = "";
    private Instituicao instituicaoAutor;
    
    public Autor()
    {
        this.instituicaoAutor = new Instituicao();
        
    }
    
    public String getLattes() {
        return lattes;
    }

    public void setLattes(String lattes) {
        this.lattes = lattes;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUltimoNome() {
                     
        return ultimoNome.toUpperCase();
    }

    public void setUltimoNome(String ultimoNome) {
        this.ultimoNome = ultimoNome;
    }

    public String getRestanteNome() {
        return restanteNome;
    }

    public void setRestanteNome(String restanteNome) {
        this.restanteNome = restanteNome;
    }

    public Instituicao getInstituicaoAutor() {
        return instituicaoAutor;
    }

    public void setInstituicaoAutor(Instituicao instituicaoAutor) {
        this.instituicaoAutor = instituicaoAutor;
    }
    
    public String getNome(){
        return restanteNome + " " + ultimoNome;
    }

    @Override
    public String toString() {
        return this.getNome() + " ";
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 67 * hash + this.id;
        hash = 67 * hash + (this.ultimoNome != null ? this.ultimoNome.hashCode() : 0);
        hash = 67 * hash + (this.restanteNome != null ? this.restanteNome.hashCode() : 0);
        hash = 67 * hash + (this.lattes != null ? this.lattes.hashCode() : 0);
        hash = 67 * hash + (this.instituicaoAutor != null ? this.instituicaoAutor.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Autor other = (Autor) obj;
        if (this.id != other.id) {
            return false;
        }
        if ((this.ultimoNome == null) ? (other.ultimoNome != null) : !this.ultimoNome.equals(other.ultimoNome)) {
            return false;
        }
        if ((this.restanteNome == null) ? (other.restanteNome != null) : !this.restanteNome.equals(other.restanteNome)) {
            return false;
        }
        return true;
    }
    

   
    
    
}
